﻿/********************************************************************
	日期:2022/4/28 21:24
	名称:Program
	邮箱:yunnibbd@163.com
	作者:yunni
	描述:网络通信协议(客户端和服务端共用)
*********************************************************************/

using System;
using PENet;

namespace PEProtocol{
    [Serializable]
    public class GameMsg : PEMsg{
        public ReqLogin reqLogin;
        public ResLogin resLogin;

        public ReqRename reqRename;
        public ResRename resRename;

        public ReqGuide reqGuide;
        public ResGuide resGuide;

        public ReqStrong reqStrong;
        public ResStrong resStrong;

        public SndChat sndChat;
        public PshChat pshChat;

        public ReqBuy reqBuy;
        public ResBuy resBuy;

        public ReqHeart reqHeart;
        public ResHeart resHeart;

        public PshPower pshPower;

        public ReqTakeTaskReward reqTakeTaskReward;
        public ResTakeTaskReward resTakeTaskReward;
        public PshTaskPrg pshTaskPrg;

        public ReqBFFight reqBfFight;
        public ResBFFight resBfFight;
    }

    #region 引导相关

    [Serializable]
    public class ReqGuide{
        public int guideid;
    }

    [Serializable]
    public class ResGuide{
        public int guideid;
        public int coin;
        public int lv;
        public int exp;
    }

    #endregion

    #region 心跳包

    [Serializable]
    public class ReqHeart{
        
    }

    [Serializable]
    public class ResHeart{
        
    }

    #endregion
    

    #region 登录相关

    [Serializable]
    public class ReqLogin{
        public string acct;
        public string pass;
    }

    [Serializable]
    public class ResLogin{
        public PlayerData playerData;
    }

    [Serializable]
    public class PlayerData{
        public int id;
        public string name;
        public int level;
        public int exp;
        public int power;
        public int coin;
        public int diamond;
        public int crystal;        

        public int hp;
        public int ad;
        public int ap;
        public int addef;
        public int apdef;
        public int dodge;
        public int pierce;
        public int critcal;
        public int guideid;
        public int[] strongArr;
        public long time;
        public string[] taskArr;
        public int fuben;
    }

    [Serializable]
    public class ReqRename{
        public string name;
    }

    [Serializable]
    public class ResRename{
        public string name;
    }

    #endregion

    #region 强化相关

    [Serializable]
    public class ReqStrong{
        public int pos;
    }
    
    [Serializable]
    public class ResStrong{
        public int coin;
        public int crystal;
        public int hp;
        public int ad;
        public int ap;
        public int addef;
        public int apdef;
        public int[] strongArr;
    }
    
    #endregion

    #region 聊天相关

    [Serializable]
    public class SndChat{
        public string chat;
    }

    [Serializable]
    public class PshChat{
        public string name;
        public string chat;
    }

    #endregion

    #region 资源交易

    [Serializable]
    public class ReqBuy{
        public int type;
        public int cost;
    }

    [Serializable]
    public class ResBuy{
        public int type;
        public int dimond;
        public int coin;
        public int power;
    }

    #endregion

    #region 体力

    [Serializable]
    public class PshPower{
        public int power;
    }

    #endregion

    #region 任务奖励

    [Serializable]
    public class ReqTakeTaskReward{
        public int rid;
    }
    
    [Serializable]
    public class ResTakeTaskReward{
        public int coin;
        public int lv;
        public int exp;
        public string[] taskArr;
    }

    [Serializable]
    public class PshTaskPrg{
        public string[] taskArr;
    }

    #endregion

    #region 副本战斗相关

    [Serializable]
    public class ReqBFFight{
        public int fbid;
    }
    
    [Serializable]
    public class ResBFFight{
        public int fbid;
        public int power;
    }

    #endregion

    public enum CMD{
        None = 0,

        //登录相关 100
        ReqLogin = 101,
        ResLogin = 102,

        ReqRename = 103,
        ResRename = 104,
        
        //主城相关
        ReqGuide = 200,
        ResGuide = 201,
        
        //强化相关
        ReqStrong = 203,
        ResStrong = 204,
        
        //chat相关
        SndChat = 205,
        PshChat = 206,
        
        //购买相关
        ReqBuy = 207,
        ResBuy = 208,
        
        //心跳
        ReqHeart = 209,
        ResHeart = 210,
        
        //体力相关
        PshPower = 211,
        
        //任务奖励
        ReqTakeTaskReward = 212,
        ResTakeTaskReward = 213,
        
        //任务进度
        PshTaskPrg = 214,

        //副本战斗
        ReqFBFight = 301,
        ResFBFight = 302,
    }

    public enum ErrorCode{
        None = 0, //没有错误
        ServerDataError, //服务器数据异常
        UpdateDBError, //更新数据库出错
        ClientDataError, //客户端数据错误
        AcctIsOnLine, //账号已经上线
        WrongPass, //密码错误
        NameIsExists, //名字已经存在
        LackLevel,
        LackCoin,
        LackCrystal,
        LackDiamond,
        LackPower,
    }

    public class SvcCfg{
        // public const string svcIP = "192.168.137.33";
        public const string svcIP = "0.0.0.0";
        public const int svcPort = 8888;
    }
    
    public class ClientCfg{
        // public const string svcIP = "192.168.137.33";
        public const string svcIP = "42.192.165.127";
        public const int svcPort = 8888;
    }
}
